package com.dxl.entity;

import com.dxl.enums.ResultEnums;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data // 自动注入
//@ApiModel("基本类型")
public class ResponseData<T> {
    @ApiModelProperty("成功失败")
    private Boolean success;
    @ApiModelProperty("错误码")
    private String code;
    @ApiModelProperty("错误信息")
    private String msg;
    @ApiModelProperty("返回数据")
    private T data;

    public ResponseData(Boolean success,String code, String msg, T data) {
        this.success = success;
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResponseData(Boolean success, ResultEnums resultEnums, T data) {
        this.success = success;
        this.code = resultEnums.getCode();
        this.msg = resultEnums.getMsg();
        this.data = data;
    }

}